namespace FastDevTemplate.Service.Interface.DTO;

public class UserTokenInfoDto
{
    public string Token { get; set; } = "";

    public UserLoginDto UserLoginDto { get; set; } = new UserLoginDto();

    public long LoginAt { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();

    public bool IsExpirationByMinute(int expirationMinute)
    {
        var loginTime = DateTimeOffset.FromUnixTimeMilliseconds(LoginAt);

        // 计算当前时间和Unix时间戳的时间间隔
        var timeDifference = DateTime.UtcNow - loginTime;

        // 检查时间间隔
        return timeDifference.TotalMinutes > expirationMinute;
    }

    public void UpdateLoginTime()
    {
        LoginAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
    }
}